package leetcode;

import java.util.*;

class Node {
    public int val;
    public List<Node> children;

    public Node() {}

    public Node(int _val) {
        val = _val;
    }

    public Node(int _val, List<Node> _children) {
        val = _val;
        children = _children;
    }
}
public class LeetCodeMain69 {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        while (in.hasNext()){
            int n=in.nextInt();
            if (n==0){
                break;
            }
            int count=0;
            while (n>1){
                if (n%3==0){
                    n=n/3;
                }else {
                    n=n/3+1;
                }
                count++;
            }
            System.out.println(count);
        }
    }

    private int count;
    LeetCodeMain69(int a){
        count=a;
    }
    String s="666";
    public static void main3(String[] args) {
        LeetCodeMain69 main69=new LeetCodeMain69(88);
        LeetCodeMain69 main68=new LeetCodeMain69(88);
        System.out.println(main69.equals(main68));
        System.out.println(main69.s.equals(main68.s));

    }
    public int openLock(String[] deadends, String target) {
        Set<String> set=new HashSet<>();
        for (String str:deadends) {
            set.add(str);
        }
        Set<String> book=new HashSet<>();
        Queue<String> q=new LinkedList<>();
        if (set.contains("0000")){
            return -1;
        }
        q.offer("0000");
        book.add("0000");
        int step=0;
        while (!q.isEmpty()){
            int size=q.size();
            while (size>0){
                size--;
                String s=q.poll();
                if (s.equals(target)){
                    return step;
                }
                for (int i = 0; i < s.length(); i++) {
                    char ch1=s.charAt(i);
                    char ch2=s.charAt(i);
                    if (ch1=='9'){
                        ch1='0';
                    }else {
                        ch1++;
                    }
                    if (ch2=='0'){
                        ch2='9';
                    }else {
                        ch2--;
                    }
                    StringBuilder sb1=new StringBuilder(s);
                    StringBuilder sb2=new StringBuilder(s);
                    sb1.setCharAt(i,ch1);
                    sb2.setCharAt(i,ch2);
                    if (!set.contains(sb1.toString())&&!book.contains(sb1.toString())){
                        q.offer(sb1.toString());
                        book.add(sb1.toString());
                    }
                    if (!set.contains(sb2.toString())&&!book.contains(sb2.toString())){
                        q.offer(sb2.toString());
                        book.add(sb2.toString());
                    }
                }
            }step++;
        }
        return -1;
    }

    public int ladderLength(String beginWord, String endWord, List<String> wordList) {
        Set<String> wordDict = new HashSet<>();
        for(String wd : wordList)
        {
            wordDict.add(wd);
        }
        Set<String> visited = new HashSet<>();
        visited.add(beginWord);
        Queue<String> q = new LinkedList<>();
        q.offer(beginWord);
        int res = 1;
        while (!q.isEmpty()) {
            int nextSize = q.size();
            while (nextSize-- != 0) {
                String curWord = q.peek();
                q.poll();
                for (int i = 0; i < curWord.length(); i++) {
                    StringBuilder newWord = new StringBuilder(curWord);
                    for (char ch = 'a'; ch <= 'z'; ch++) {
                        newWord.setCharAt(i, ch);
                        String changeWord = newWord.toString();
                        if (!wordDict.contains(changeWord) || visited.contains(changeWord))
                            continue;
                        if (changeWord.equals(endWord))
                            return res + 1;
                        visited.add(changeWord);
                        q.offer(changeWord);
                    }
                }
            }
            res++;
        }
        return 0;
    }
    public List<List<Integer>> levelOrder(Node root) {
        List<List<Integer>> list=new ArrayList<>();
        Queue<Node> queue=new LinkedList<>();
        if (root==null){
            return list;
        }
        queue.add(root);
        while (!queue.isEmpty()){
            List<Integer> list1=new ArrayList<>();
            int size=queue.size();
            while (size>0){
                Node node=queue.poll();
                list1.add(node.val);
                for (Node s1:node.children) {
                    if (s1!=null){
                        queue.add(s1);
                    }
                }
                size--;
            }
            if (!list1.isEmpty()){
                list.add(list1);
            }
        }
        return list;
    }
    class pair{
        int x;
        int y;
        public pair(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }
    public int orangesRotting(int[][] grid) {
        int count=0;
        Queue<pair> queue=new LinkedList<>();
        if (grid==null){
            return 0;
        }
        int row=grid.length;
        int col=grid[0].length;
        for (int i = 0; i < row; i++) {
            for (int j = 0; j < col; j++) {
                if (grid[i][j]==2){
                    queue.add(new pair(i,j));
                }
            }
        }
        int[][] nextP={{1,0},{-1,0},{0,1},{0,-1}};
        while (!queue.isEmpty()){
            int size=queue.size();
            boolean flag=false;
            while (size>0){
                size--;
                pair cur=queue.poll();
                for (int i = 0; i < 4; i++) {
                    int newX=cur.x+nextP[i][0];
                    int newY=cur.y+nextP[i][1];
                    if (newX<0||newY<0||newX>=row||newY>=col){
                        continue;
                    }
                    if (grid[newX][newY]==1){
                        grid[newX][newY]=2;
                        flag=true;
                        queue.offer(new pair(newX,newY));
                    }
                }
                }
            if (flag==true){
                count++;
            }
        }
        for (int i = 0; i < row; i++) {
            for (int j = 0; j < col; j++) {
                if (grid[i][j]==1){
                    return -1;
                }
            }
        }
        return count;
    }
}
